import Vue from 'vue'
import VueI18n from 'vue-i18n'
import zhCN from './lang/zh-CN'
import en from './lang/en'

import storage from '../../utils/storage'

Vue.use(VueI18n)

// 从本地存储获取当前语言，默认中文
// const locale = storage.get('lang') || 'zh-CN'
const locale =  'zh-CN'

const i18n = new VueI18n({
  locale,
  fallbackLocale: 'zh-CN', //  fallback 语言
  messages: {
    'zh-CN': zhCN,
    'en': en
  }
})

export default i18n
